<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="s" uri="/struts-tags"%>
<%@taglib prefix="pu" uri="/WEB-INF/tld/pageutil.tld" %>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c-rt"%>
<%@taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt-rt"%>
<c-rt:if test="${order.orderSt=='10' || order.orderSt=='20'}">
<script>
$(function(){
	$('#cancelOrder_button').click(function(){
		hasError=false;
		isChecked=false;
		checkedValue='';
		for(i=0;i<document.cancelOrderForm.reason.length;i++){
			if(document.cancelOrderForm.reason[i].checked){
				isChecked=true;
				checkedValue=document.cancelOrderForm.reason[i].value;
			}
		}
		if(!isChecked){
			hasError=true;
			alert('请选择取消订单原因');
		}
		if(checkedValue=='其它'){
			if(document.cancelOrderForm.description.value==''){
				hasError=true;
				alert('请描述原因');
			}
		}
		if(!hasError){
			if (!confirm("确定取消订单?")) return;
			$('#cancelOrder_button').hide();
			$('#closeCancelDialog_button').hide();
			$('#hiddenWord').show();
			doAR('<c-rt:url value="/order/cancel/cancelOrder.do"/>', 'cancelDialog', 'cancelOrderForm');
		}		
	});
	
	$('#closeCancelDialog_button').click(function(){
		closeCancelDialog();
	});
});
</script>
<p><strong>取消原因</strong></p> 
<c-rt:if test="${order.orderId ne order.joinOrders}">该单合并结帐, 订单 ${order.joinOrders} 将一并取消</c-rt:if>
    <form name="cancelOrderForm">    
    	<table border="0" cellspacing="4">
    		<tr>
    			<td width="50%"><label><input type="radio" value="想改商品属性（如颜色、尺寸等）" name="reason"> 想改商品属性（如颜色、尺寸等）</label></td>
    			<td width="50%"><label><input type="radio" value="想加买其他商品" name="reason"> 想加买其他商品</label></td>
    		</tr>
    		<tr>
    			<td><label><input type="radio" value="买错了" name="reason"> 买错了</label></td>
    			<td><label><input type="radio" value="等太久" name="reason"> 等太久</label></td>
    		</tr>
    		<tr>
    			<td><label><input type="radio" value="结帐金额与活动不符" name="reason"> 结帐金额与活动不符</label></td>
    			<td><label><input type="radio" value="商品比其他家贵" name="reason"> 商品比其他家贵</label></td>
    		</tr>
    		<tr>
    			<td><label><input type="radio" value="支付不成功" name="reason"> 支付不成功</label></td>
    			<td><label><input type="radio" value="网路风评不好" name="reason"> 网路风评不好</label></td>
    		</tr>
    		<tr>
    			<td><label><input type="radio" value="有新的优惠活动" name="reason"> 有新的优惠活动</label></td>
    			<td><label><input type="radio" value="商品断货／缺货" name="reason"> 商品断货／缺货</label></td>
    		</tr>
    		<tr>
    			<td><label><input type="radio" value="要改地址／收货人" name="reason"> 要改地址／收货人</label></td>
    			<td><label><input type="radio" value="收货资讯不完整" name="reason"> 收货资讯不完整</label></td>
    		</tr>
    		<tr>
    			<td colspan="2"><label><input type="radio" value="其它" name="reason"> 其它</label> <input type="text" size="15" id="description" name="description"></td>
    		</tr>
    		<tr><td colspan="4">&nbsp;</td></tr>
    		<tr>
    			<td colspan="4">订单内部备注说明<br/><textarea name="memo" rows="4" cols="65"></textarea></td>
    		</tr>
    				
		</table>    	
    	
         <input type="hidden" name="token" value="${pu:getToken() }"/>
    	<input type="hidden" name="orderId" id="orderId" value="${param.orderId }"/>    	 
  </form> 
  <p class="c-f"  align="center"><a href="javascript:;" id="cancelOrder_button" class="btn-mid" onFocus="blur()">确定取消订单</a>
  <a href="javascript:;" id="closeCancelDialog_button" class="btn-mid">关闭</a>
  <br/>
  <span id="hiddenWord" style="display:none">订单取消处理中，请等待系统作业时间</span>
  </p> 
  </c-rt:if>
  <c-rt:if test="${order.orderSt=='81'}">
  <p>您已取消此笔订单!<br />您所取消的订单可能因為系统尚未更新状态，请耐心等待系统处理完成。</p> 
   <p class="c-f"  align="center"><a href="javascript:closeDialog();"class="btn-mid" onFocus="blur()">确定</a></p> 
  </c-rt:if>
  
